#ifndef app_user_h__
#define app_user_h__

#include "common.h"
#include "router.h"
#include <mutex>

#include "boost/regex.hpp"

struct app_info
{
	std::string _app_name;
	std::string _app_path;
	void* _h_dll;
};

class app_admin : 
	public router_family
{
public:
	app_admin();

private:
	std::map<std::string, app_info> _app_map;
	std::mutex _mutex;

	bool is_app_registered(const std::string& app_path);
	void register_app(const std::string& app, const std::string& path, void* hDLL);
	void* delete_registered_app(const std::string& app);
	std::string get_app_path(const std::string& app);

	void render_app_list(response& res);

	void load_app(std::string& app_path);
	void unload_app(std::string& app_name);
	void reload_app(std::string& app_name);
};


#endif // app_user_h__
